package com.se.domain.dto;

import com.se.domain.mysql.OptionDO;
import com.se.domain.request.param.QParam;
import lombok.Data;

import java.util.LinkedList;
import java.util.List;

@Data
public class QuestionDTO {
    Long qId;
    Long qnId;
    String title;
    Byte type;

    List<OptionDO> optionDOList = new LinkedList<>();

    public QuestionDTO(Long qnId, QParam qParam) {
        this.qnId = qnId;
        this.title = qParam.getTitle();
        this.type = qParam.getType();
        if(qParam.getOptions() != null){
            for (String option : qParam.getOptions()) {
                this.optionDOList.add(new OptionDO(option));
            }
        }

    }
}
